Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
				
		Super.OnCreate()
				
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		'DISPLAY.SetVirtualSize(480,320)
		
		' Global switch to show DEBUG infos
		DEBUG = True
		
		Return 0
	End

	
End


Class TTmpScreen Extends TScreen
	

	Field pivot:TPivot	
	Field a:Float = 0
	
	
	' START when app is created
	Method Start:Void()
		
		Self.pivot = New TPivot("Pivot",320,240,32,32)
		
		Self.pivot.speed = 0.5
		Self.pivot.collision.Set(New TVector2(0,0),New TVector2(16,16),8)
	
	End
	
	' main app logic loop update
	Method Update:Void()
		
		a+=1*AppSpeed()
		
		'Self.pivot.rotation = a
		
		' update direction vector from angle
		'Self.pivot.SetDirectionByRotation()
		
		' test - move with delta [1,0]
		'Self.pivot.Move(1,0)
		
		' test - move forward
		'Self.pivot.MoveForward()
		
		'test - move to point
		'Self.pivot.MoveTo(640,480)
		
		'test - look at
		'Self.pivot.LookAt(MOUSE.x,MOUSE.y)
		
		' test - move in actual direction		
		Self.pivot.MoveForward()
		
		' test - move in right normal from actual direction		
		'Self.pivot.Move(VecRightNormal(Self.pivot.direction))
		
		' test TurnToTarget
		Self.pivot.TurnToTarget(New TVector2(MOUSE.x,MOUSE.y),2.0)
		
		' Update pivot
		Self.pivot.Update()
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		
		Self.pivot.Draw()
		
		
	End
End












